import Vue from 'vue'
import App from './App.vue'
import router from './router'
import '@/assets/scss/index.scss'
import store from './store'
import axios from 'axios'
Vue.prototype.$axios = axios;
Vue.config.productionTip = false;

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)
// 高德地图
import VueAMap from 'vue-amap';
Vue.use(VueAMap);
VueAMap.initAMapApiLoader({
  key: '6602bf45bb4b9ddec5fe40effb74d161',
  //插件
  plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
  // 默认高德 sdk 版本为 1.4.4
  v: '1.4.4'
});

// 视频
import Video from 'video.js';
import 'video.js/dist/video-js.css';
Vue.prototype.$video=Video
import VueVideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'
Vue.use(VueVideoPlayer)

Vue.config.productionTip = false
axios.interceptors.request.use(
  config => {
    // 判断是否存在token，如果存在的话，则每个http header都加上token
    let token = localStorage.getItem('Authorization');
    if (!config.headers.hasOwnProperty('Authorization') && token) {
        config.headers.Authorization = token;
    }
    return config;
  },
  error => {
    return Promise.reject(error);
});
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
